package com.macro.mall.portal.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.macro.mall.portal.domain.UserIncome;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author
 * @since 2021-10-12
 */
public interface UserIncomeMapper extends BaseMapper<UserIncome> {

    @Select("SELECT * FROM   user_income  WHERE DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) ,'%Y%m' )  and open_id= #{openId} ")
    List<UserIncome> maths(@Param("openId") String openId);

    @Select("SELECT * FROM user_income WHERE PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( create_time, '%Y%m' ) ) =1 and open_id= #{openId} ")
    List<UserIncome> lastMath(@Param("openId") String openId);

}
